<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="com.serviceprovider.business.utility.SecurityContextUser"%>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<%@include file="/WEB-INF/taglibs/common/taglibs.jsp"%>

<head>
<title><spring:message code="sp.selffeereport.title" /></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link  rel="stylesheet" href="<c:url value="/css/styles.css"/>"/>
<link  rel="stylesheet" href="<c:url value="/javascripts/jscalendar/theme/calendar-system.css"/>"/>
<script src="<c:url value="/javascripts/jscalendar/calendar-cfg.js"/>" ></script>
<script src="<c:url value="/javascripts/calendar.js"/>" ></script>
<script src="<c:url value="/javascripts/jscalendar/lang/calendar-en.js"/>" ></script>
<script src="<c:url value="/javascripts/jscalendar/calendar-setup.js"/>" ></script>    

<script src="<c:url value="/javascripts/common.js"/>">
</script>
</head>
<body><div class="page">
    <%
    Object isAdmin = SecurityContextUser.isAdmin();
    if(Boolean.TRUE.equals(isAdmin)){
        %>
            <%@include file="../../admin/top_menu.jsp"%>
        <%
    } else{
        %>
            <%@include file="../top_menu.jsp"%>
        <%
    }
    %>
<table width=100%>
	<tr>
		<td><%@include file="/WEB-INF/jsp/include/messages.jsp"%>
		<br />
		</td>
	</tr>

</table>
<div class="contentArea">
	<table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr><td colspan="2">
		<%@include file="/WEB-INF/jsp/include/header.jsp"%>
		</td>
			</tr>
			<tr><td colspan="2">
		<c:import url="/WEB-INF/jsp/include/provider.jsp" />
		</td>
			</tr>
			<tr>
				<td><h4><spring:message code="sp.allfeesreports.label.standardreportview" /></h4></td>
				<td align="right">
						<span><a href="#">${level1userid}</a></span>
						<span><a href="#">${level1username}</a></span>
				</td>
			</tr>
		</table>
	<c:import url="select_report.jsp" />
	<div class="table_title" style="background: none;"><spring:message code="sp.selffeereport.label.selffeereport" /></div>
    <c:forEach var="transReport" items="${selfFeeReportData.transReportData}" varStatus="i">
        <table border=0 cellpadding=4 cellspacing=1 width=100%>
            <tr><td colspan="${transReport.numberOfPayees + 8}" class="table_title"><spring:message code="sp.selffeereport.label.batch" /> #${transReport.batch.id} - <fmt:formatDate pattern="MMM dd yyyy hh:mm" value="${transReport.batch.batchDate}" /></td></tr>
			<tr>
				<th><spring:message code="sp.selffeereport.label.ser" /></th>
				<th><spring:message code="sp.selffeereport.label.ssn" /></th>
				<th><spring:message code="sp.selffeereport.label.customername" /></th>
				<th><spring:message code="sp.selffeereport.label.amountreceived" /></th>
                <th><spring:message code="sp.selffeereport.label.customerbalance" /></th>
                <th><spring:message code="sp.selffeereport.label.svcfee" /></th>
				<th><spring:message code="sp.selffeereport.label.selffee" /></th>
                <c:forEach var="payee" items="${transReport.allPayees}" varStatus="i">
                    <th>${payee.fullName}</th>    
                </c:forEach>
                <th><spring:message code="sp.selffeereport.label.total" /></th>
			</tr>
    		<c:forEach var="record" items="${transReport.records}" varStatus="i">
				<tr>
					<td>${i.index+1}</td>
					<td>${record.ssn}</td>
					<td>${record.customerName}</td>
					<td><fmt:formatNumber pattern="${currenyPattern}" value="${record.amount}" /></td>
                    <td><fmt:formatNumber pattern="${currenyPattern}" value="${record.customerBalance}" /></td>
                    <td><fmt:formatNumber pattern="${currenyPattern}" value="${record.serviceFee}" /></td>
					<td><fmt:formatNumber pattern="${currenyPattern}" value="${record.selfFee}" /></td>
                    <c:forEach var="payee" items="${transReport.allPayees}" varStatus="i">
                        <td><fmt:formatNumber pattern="${currenyPattern}" value="${record.amountOfUser[payee.id]}" /></td>    
                    </c:forEach>
                    <td><fmt:formatNumber pattern="${currenyPattern}" value="${record.totalAll}" /></td>
				</tr>
    		</c:forEach>
            <tr>
            	<td colspan="${transReport.numberOfPayees + 8}"><hr /></td>
            </tr>		
            <tr>
            	<td class="totals"><spring:message code="sp.selffeereport.label.selffeetotals" />:</td>
            	<td colspan="2" class="totals"></td>
            	<td class="totals"><fmt:formatNumber pattern="${currenyPattern}" value="${transReport.totalAmount}" /></td>
                <td class="totals"><fmt:formatNumber pattern="${currenyPattern}" value="${transReport.totalCustomerBalance}" /></td>
                <td class="totals"><fmt:formatNumber pattern="${currenyPattern}" value="${transReport.totalServiceFee}" /></td>
            	<td class="totals"><fmt:formatNumber pattern="${currenyPattern}" value="${transReport.selfFeeTotals}" /></td>
                <c:forEach var="total" items="${transReport.totalPayeeAmounts}" varStatus="i">
                    <td class="totals"><fmt:formatNumber pattern="${currenyPattern}" value="${total}" /></td>    
                </c:forEach>
                <td class="totals"><fmt:formatNumber pattern="${currenyPattern}" value="${transReport.totalAll}" /></td>
            </tr>
    	</table><br/>
    </c:forEach>
</div></div><%@include file="/WEB-INF/jsp/include/footer.jsp"%>
</body>

</html>
